class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int dest = 0, cur = price.size() - 1;
        while (dest < cur) {
            if (price[dest] + price[cur] > target) {
                cur--;
            } else if (price[dest] + price[cur] < target) {
                dest++;
            } else {
                break;
            }
        }
        return {price[dest], price[cur]};
    }
};